import request from '@/utils/request'
export function getUserListApi(params) {
  return request({
    url: '/permission/user',
    method: 'get',
    params
  })
}
export function addUserApi(data) {
  return request({
    url: '/permission/user',
    method: 'post',
    data
  })
}
// * 上传用户头像
export const uploadImgApi = data => {
  return request({
    method: 'post',
    url: '/index/upload?mode=single&type=image',
    data
  })
}
// 获取单行数据回显
export function getUserInfoApi(id) {
  return request({
    url: '/permission/user/' + id,
    method: 'get'
  })
}
// 删除数据
export function delUserApi(id) {
  return request({
    url: '/permission/user/' + id,
    method: 'DELETE'
  })
}
// 修改后数据的提交
export function updataUserApi(data) {
  return request({
    url: '/permission/user/' + data.id,
    method: 'put',
    data
  })
}
// switch开发触发修改状态
export function changeUserStatus(params) {
  return request({
    url: `/permission/user/${params.id}/${params.status}`
  })
}
